<form class="layui-form" id="workOrdersForm" action="/apps/workorders/workflow/approval.html" method="post" style="width: 100%;height: 100%;" enctype="multipart/form-data">
	<#if workOrders??><input type="hidden" name="id" value="${workOrders.id!''}"></#if>
	<#if task??><input type="hidden" name="taskid" value="${task.id!''}"></#if>
	<#if task??><input type="hidden" name="orderid" value="${task.orderId!''}"></#if>
	<#if workOrders??><input type="hidden" name="dataid" value="${workOrders.id!''}"></#if>
	<div class="row" style="border-bottom: 1px solid #EFEFEF;">
		<div class="col-lg-12" style="padding-left:0px;padding-right:0px;">
			<h1 class="site-h1">
				工单回复
			</h1>
			<div id="ukefu-comments">
				<div class="ukefu-workorders-comment" id="ukefu-workorders-comment">
					<#if orderCommentList?? && orderCommentList.content?size gt 0>
					<#include "/apps/business/workorders/comments.html">	
					</#if>
				</div>
			</div>
			
			
			<h1 class="site-h1" style="border-top:1px solid #e6e6e6;margin-top:15px;">
				审批
			</h1>
			<div class="row" style="margin-top:5px;">
				<div class="col-lg-5" style="padding-left:0px;line-height:30px;padding-right:0px;">
					<div class="layui-form-item">
					    <div class="layui-input-block" style="margin-left:75px;">
							<input type="radio" name="approval" lay-filter="agree" value="agree" title="同意" checked>
							<input type="radio" name="approval" lay-filter="den" value="den" title="拒绝">
							<input type="radio" name="approval" lay-filter="back" value="back" title="退回">
							<input type="radio" name="approval" lay-filter="turn" value="turn" title="转办">
					    </div>
					</div>	
				</div>
				<div class="col-lg-7" id="approval" style="padding-left:0px;line-height:30px;padding-right:0px;">
					<div id="back" style="display:none;">
						<div class="layui-form-item">
						    <label class="layui-form-label">退回到：</label>
						    <div class="layui-input-block" style="padding-top:3px;">
						      	<input type="radio" name="retback" lay-filter="back" value="1" checked="checked" title="创建人">
						    </div>
						</div>
					</div>
					<div id="turn" style="display:none;">
						<div class="layui-inline">
							<label class="layui-form-label">转办给：</label>
							<div class="layui-input-inline" style="width: 145px;">
								<select lay-ignore class="ukefu-select" name="accdept" id="accdept" style="width: 100%">
									<option value="">请选择部门</option>
								 	<#if organList??>
								 	<#list organList as organ>
								 	<option value="${organ.id!''}">${organ.name!''}</option>
								 	</#list>
								 	</#if> 
								</select>
							</div>
							<div class="layui-input-inline" style="width: 200px;" id="deptuserdiv">
								<#include "/apps/business/workorders/deptuser.html">
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="row" style="margin-top:5px;">
				<div class="col-lg-12" style="padding-left:0px;line-height:30px;padding-right:0px;padding-left:75px;">
					<textarea name="content" id="content" style="width:100%;height:60px;"></textarea>	
				</div>
			</div>
			<div class="row" style="margin-top:5px;">
				<div class="col-lg-12" style="padding-left:0px;line-height:30px;padding-right:0px;padding-left:75px;">
					<div class="layui-form-item">
						<div class="layui-input-block ukefu-form-block" style="margin-left:0px;">
							<div class="layui-box layui-upload-button">
								<input type="file" name="files"
									accept="*"
									class="layui-upload-file"
									onchange="$(this).closest('.layui-form-item').append($(this).closest('.ukefu-form-block').prop('outerHTML'));$(this).closest('.ukefu-form-block').find('.file_ad').html($(this).val());$(this).closest('.ukefu-form-block').find('.file_del').show();"><span
									class="layui-upload-icon"><i class="layui-icon">&#xe608;</i>上传附件</span>
							</div>
							<span>
								<span class="file_ad"></span>
								<span class="file_del" style="display:none;">
									<a href="javascript:void(0)" style="margin-left:10px;" onclick="$(this).closest('.ukefu-form-block').remove();">
										<i class="layui-icon" style="color:red;">&#x1006;</i>
										删除
									</a>
								</span>
							</span>
						</div>
					</div>	
				</div>
			</div>
			<div class="layui-button-block" style="margin-top:20px;margin-left:75px;text-align:left;">
				<button class="layui-btn" lay-submit="" lay-filter="formDemo">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</div>
</form>
<script>
layui.use('form', function(){
  var form = layui.form;
  form.on('radio(agree)', function(data){
	  $("#back").hide();
	  $("#turn").hide();
  });
  form.on('radio(den)', function(data){
	  $("#back").hide();
	  $("#turn").hide();
  });
  form.on('radio(back)', function(data){
	  $("#back").show();
	  $("#turn").hide();
  });
  form.on('radio(turn)', function(data){
	  $("#back").hide();
	  $("#turn").show();
  });
});
$(document).ready(function() {
	$(".ukefu-select").select2({minimumResultsForSearch: Infinity});
	$('#accdept').on('select2:select', function (evt) {
		 //选择部门下的 人员
		 loadURL("/apps/workorders/dept/user.html?dept="+evt.target.value , "#deptuserdiv");
	});
});
</script>